<%-- 
    Document   : categoria
    Created on : 12/03/2013, 10:37:58 PM
    Author     : user10
--%>

<%@page contentType="text/html" pageEncoding="windows-1252"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/dhtmlxSuite/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">
        <script src="${pageContext.request.contextPath}/resources/dhtmlxSuite/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
        <script src="${pageContext.request.contextPath}/resources/dhtmlxSuite/dhtmlxForm/codebase/dhtmlxform.js"></script>
        </head>
                  <body>
         <div id="myForm" style="height:500px;" ></div>
        <script>
            var myForm,
            formData;
          
            formData = [{
                    type: "settings",
                    position: "label-left",
                    labelWidth: 130,
                    inputWidth: 120
                }, {
                    type: "fieldset",
                    label: "Alta Categoria",
                    inputWidth: "auto",
                    list: [
                        {
                            type: "input",
                            label: "nombre",
                            name: "nombre",
                            required: true
                        }, {
                            type: "input",
                            label: "Detalles",
                            name: "detalles",
                            required: true
                        }
                        ,  {
                            type: "button",
                            value: "Guardar",
                            name: "button"
                        }]
                }];
           
            myForm = new dhtmlXForm("myForm",formData);
             myForm.enableLiveValidation(true);
            //  var dp = new dataProcessor("categoria/insertcat");
              //            dp.init(formData);
                //          myForm.load("categoria/insertcat clave =?"+clave);
                      //    myForm.send("categoria/insertcat","post");
                         myForm.attachEvent("onButtonClick", function(buttonid) {
                          if(buttonid=="button"){
                         //myForm.save();
 
        if(myForm.validate()){ 
   //myForm.load("categoria/insertcat","get");
   myForm.send("insertcat","post");
    //                     var dp = new dataProcessor("categoria/insertcat");
      //                    dp.init(myForm);
      alert(myForm.validate());
        }
    }
                           //   ,function(loader, response){alert(response);}
                           //   alert( myForm.validate());         
              // myForm.validate(); 
            }
        );
         </script>
         
    </body>
</html>
